<%--
  Created by IntelliJ IDEA.
  User: 冷丶
  Date: 2017/10/24
  Time: 18:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>购物车</title>
</head>
<body>
您购物车中的商品有:
<a href="${pageContext.request.contextPath}/addShopServlet">添加</a>
<table border="1" cellspacing="0" width="700px" id="">
    <tr>
        <td width="10%">序号</td>
        <td width="60%">商品名称</td>
        <td width="10%">价格</td>
        <td width="20%">操作</td>
    </tr>
    <c:forEach var="c" items="${cart}" varStatus="status">
        <c:choose>
            <c:when test="${status.count%2==0}">
                <tr style="background-color: gray">
                    <td>${status.count}</td>
                    <td>${c.pname}</td>
                    <td>${c["market_price"]}</td>
                    <td><a href="${pageContext.request.contextPath}/updateServlet?pid=${p.pid}">修改 </a><a href="${pageContext.request.contextPath}/deleteCartServlet?pid=${p.pid}"> 删除</a></td>
                </tr>
            </c:when>
            <c:otherwise>
                <tr>
                    <td>${status.count}</td>
                    <td>${c.pname}</td>
                    <td>${c["market_price"]}</td>
                    <td><a href="${pageContext.request.contextPath}/updateServlet?pid=${p.pid}">修改 </a><alert href="${pageContext.request.contextPath}/deleteCartServlet?pid=${p.pid}"> 删除</alert></td>
                </tr>
            </c:otherwise>
        </c:choose>
    </c:forEach>
</table>
</body>
</html>
